package zt.song.shopping.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
import lombok.Data;

/**
 *
 * @TableName t_user
 */
@TableName(value ="t_user")
@Data
public class User implements Serializable {
    /**
     * 用户id
     */
    @TableId(value = "uid", type = IdType.AUTO)
    private Integer uid;

    /**
     * 账号，唯一
     */
    @TableField(value = "username")
    @NotBlank(message = "账号不能为空")
    @Pattern(regexp = "\\w{6,}",message = "账号必须是字符开头且长度在6位以上")
    private String username;

    /**
     * 密码
     */
    @TableField(value = "password")
    @NotBlank(message = "密码不能为")
    @Pattern(regexp = "\\w{6,}", message = "密码必须是字符开头且长度在6位以上")
    private String password;

    /**
     * 手机号，唯一
     */
    @TableField(value = "mobile")
    @Pattern(regexp = "(1\\d{10})",message = "手机格式错误")
    @NotBlank(message = "手机号不能为空")
    private String mobile;

    /**
     * 用户状态
     */
    @TableField(value = "status")
    private Integer status;

    /**
     * 创建时间
     */
    @TableField(value = "createTime")
    private Date createtime;

    /**
     * 修改时间
     */
    @TableField(value = "updateTime")
    private Date updatetime;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;
}
